<?php

class ControleurQualite {
	private $nom;
	private $proba=10;
	public function __construct($n) {
		$this->nom=$n;
	}
	public function getNom() {
		return $this->nom;
	}
	
	public function controleDemarrage(&$notification) {
		$auto = &$notification->getNotificationObject();
		echo "\n\t\t" . $this->getNom() . " controle le demarrage.";
		if ( rand(1, $this->proba) == $this->proba) {
			echo "\n\t\t" . $this->getNom() . " ca demarre pas bien.";
			$notification->cancelNotification();
		} else {
			echo "\n\t\t" . $this->getNom() . " ca demarre super.";
		}
	}
    public function controleRouler(&$notification) {
		$auto = &$notification->getNotificationObject();
		echo "\n\t\t" . $this->getNom() . " controle le deplacement.";
		if ( rand(1, $this->proba) == $this->proba) {
			echo "\n\t\t" . $this->getNom() . " ca roule mal.";
			$notification->cancelNotification();
		} else {
			echo "\n\t\t" . $this->getNom() . " ca roule bien.";
		}
	}
    
	public function controleArret(&$notification) {
		$auto = &$notification->getNotificationObject();
		echo "\n\t\t" . $this->getNom() . " controle l arret.";
		if ( rand(1, $this->proba) == $this->proba) {
			echo "\n\t\t" . $this->getNom() . " ca ne s'arrete pas du tout.";
			$notification->cancelNotification();
		} else {
			echo "\n\t\t" . $this->getNom() . " ca s'arrete correctement.";
		}
	}   
}
?>